const HtmlWebpackPlugin = require('html-webpack-plugin') // * html 插件
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') // * css压缩插件

// const path = require('path')
const { merge } = require('webpack-merge')
const common = require('./webpack.config.common.js')

module.exports = merge(common, {
  mode: 'production',
  plugins: [
    new HtmlWebpackPlugin({
      title: '生产环境',
      template: './public/index.html'
    }),
    new CssMinimizerPlugin()
  ],
  // * 源码与编译后的代码的映射文件 便于调式
  // * source-map 行与列映射，缺点是会增加包大小
  devtool: 'source-map'
})
